package game.core.bullet
{
	import flash.events.Event;
	import flash.utils.getDefinitionByName;
	
	import game.core.Config;
	import game.core.GameSystem;
	import game.core.util.DisplayUtil;
	import game.manager.XMLManager;
	
	/**
	 * 子弹发射出来的算法,还需要重新整理一下
	 * 
	 */ 
	public class FireBullet extends Bullet
	{
		public function FireBullet()
		{
			super();
		}
		
		override public function createBullet():void {
			var className:String = DisplayUtil.getQualifiedClassName(this) + Config.SKIN;
			var cls:Class = flash.utils.getDefinitionByName(className) as Class;
			this.bullet = new cls();
			this.addChildAt(this.bullet,0);
		}
		
		override protected function enterFrameHandler(event:Event):void {
			var ySpeed:Number = this.data.ySpeed;
			this.bullet.y -=  ySpeed;
			super.enterFrameHandler(event);
		}
		
		override public function get data():Object {
			var name:String = DisplayUtil.getQualifiedClassName(this);
			return XMLManager.instance.getPropertyByName("items","bullets",name);
		}
		
		/**
		 * 这里的计算还需要重新写一下
		 */ 
		override protected function checkBoundary():void {
			if(this.bullet.y + GameSystem.instance.conentHeight <= 0){
				super.checkBoundary();
			}
		}
	}
}